//
//  CYPayWayCell.m
//  CaiYun
//
//  Created by 今日信息科技 on 2017/7/10.
//  Copyright © 2017年 今日信息科技. All rights reserved.
//

#import "CYPayWayCell.h"
@interface CYPayWayCell()
@property (nonatomic, strong) CYView *piont;
@property (nonatomic, strong) CYLabel *titleLBL;
@property (nonatomic, strong) CYLabel *detailTitleLBL;
@end
@implementation CYPayWayCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.piont.hidden = NO;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setSeparatorInset:UIEdgeInsetsZero];
        [self setLayoutMargins:UIEdgeInsetsZero];
    }
    return self;
}
- (CYView *)piont{
    if (!_piont) {
       _piont = [[CYView alloc]initWithColor:ColorHex(0xff5b05)];
        _piont.layer.cornerRadius = AL(PT(4));
        _piont.layer.masksToBounds = YES;
        [self addSubview:_piont];
        
        WS(self)
        [_piont mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(weakSelf);
            make.left.equalTo(weakSelf).with.offset(AL(PT(40)));
            make.size.mas_equalTo(CGSizeMake(AL(PT(8)), AL(PT(8))));
        }];
    }
    
    return _piont;
}

- (CYLabel *)titleLBL{
    if (!_titleLBL) {
      _titleLBL =  [[CYLabel alloc]initWithText:_title size:AL(PT(30)) textcolor:ColorHex(0x333333)];
        [self addSubview:_titleLBL];
        
        [_titleLBL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_piont.mas_right).with.offset(AL(PT(12)));
            make.centerY.equalTo(_piont);
            make.size.mas_equalTo(_titleLBL.bounds.size);
        }];
    }
    return _titleLBL;
}

- (CYLabel *)detailTitleLBL{
    if (!_detailTitleLBL) {
       _detailTitleLBL = [[CYLabel alloc]initWithText:[NSString stringWithFormat:@"(%@)",_detailTitle] size:AL(PT(24)) textcolor:ColorHex(0xa9a9a9)];
        [self addSubview:_detailTitleLBL];
        
        [_detailTitleLBL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_titleLBL.mas_right).with.offset(AL(PT(12)));
            make.centerY.equalTo(_titleLBL);
            make.size.mas_equalTo(_detailTitleLBL.bounds.size);
        }];
    }
    
    return _detailTitleLBL;
}

- (void)setTitle:(NSString *)title{
    if (_title != title)
        _title = title;
    self.titleLBL.hidden = NO;
}

- (void)setDetailTitle:(NSString *)detailTitle{
    if (_detailTitle != detailTitle)
        _detailTitle = detailTitle;
    self.detailTitleLBL.hidden = NO;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
